#ifndef _DVR_NET_APP_H_
#define _DVR_NET_APP_H_


#include "cross_com.h"
#include "dvr_server.h"
#include "dvr_mml_svr.h"
#include "client_sock.h"
#include "server_push_flow.h"
class CDVR_APP
{
public:
	CDVR_APP();
	~CDVR_APP();
public:
	int Init(int send_buf_sz,int portNum);
	int InitMediaSvr(int media_buf_sz,int portNum);
	int InitMediaSvrRev(int media_buf_sz,int portNum);
	int InitVideoPush(char * serverIP,int port,bool isTcp =true);
	int InitVideoPush_second(char * serverIP,int port,bool isTcp =true);
	void Destroy();

	int StartCmdSvr();
	int StartMediaSvr();
	int StartMediaSvrRcv();

	void Stop();
	void SwitchPlayMod(bool bPlay)
	{
		m_mediaSvr.SetPlayMod(bPlay);
	}

	static int PUB_THREAD_CALL ListenProcThread(void *pParam);
	static int PUB_THREAD_CALL MediaSvrListenProThread(void *pParam);
	static int PUB_THREAD_CALL MediaRecSvrListenProThread(void *pParam);
protected:

protected:
	unsigned char * m_cmdBuf;
	cross_thread_t m_dataThdID;
	cross_thread_t m_mediaThdID;
	cross_thread_t m_mediaRecThdID;
	CDVRSvrSocket  m_dvrSvr;
	
	CStreamerSvr   m_mediaSvr;
	CStreamerSvr   m_mediaSvrRcv;

	CServerPushFlow m_serverPush;
	CServerPushFlow m_serverPush_second;
};


#endif
